﻿using System;
using Terraria.Utilities;

namespace Terraria.IO
{
	// Token: 0x02000329 RID: 809
	public abstract class FileData
	{
		// Token: 0x17000217 RID: 535
		// (get) Token: 0x06001E56 RID: 7766 RVA: 0x00015878 File Offset: 0x00013A78
		public string Path
		{
			get
			{
				return this._path;
			}
		}

		// Token: 0x17000218 RID: 536
		// (get) Token: 0x06001E57 RID: 7767 RVA: 0x00015880 File Offset: 0x00013A80
		public bool IsCloudSave
		{
			get
			{
				return this._isCloudSave;
			}
		}

		// Token: 0x17000219 RID: 537
		// (get) Token: 0x06001E58 RID: 7768 RVA: 0x00015888 File Offset: 0x00013A88
		public bool IsFavorite
		{
			get
			{
				return this._isFavorite;
			}
		}

		// Token: 0x06001E59 RID: 7769 RVA: 0x00015890 File Offset: 0x00013A90
		protected FileData(string type)
		{
			this.Type = type;
		}

		// Token: 0x06001E5A RID: 7770 RVA: 0x0001589F File Offset: 0x00013A9F
		protected FileData(string type, string path, bool isCloud)
		{
			this.Type = type;
			this._path = path;
			this._isCloudSave = isCloud;
			this._isFavorite = (isCloud ? Main.CloudFavoritesData : Main.LocalFavoriteData).IsFavorite(this);
		}

		// Token: 0x06001E5B RID: 7771 RVA: 0x000158D7 File Offset: 0x00013AD7
		public void ToggleFavorite()
		{
			this.SetFavorite(!this.IsFavorite, true);
		}

		// Token: 0x06001E5C RID: 7772 RVA: 0x000158E9 File Offset: 0x00013AE9
		public string GetFileName(bool includeExtension = true)
		{
			return FileUtilities.GetFileName(this.Path, includeExtension);
		}

		// Token: 0x06001E5D RID: 7773 RVA: 0x000158F7 File Offset: 0x00013AF7
		public void SetFavorite(bool favorite, bool saveChanges = true)
		{
			this._isFavorite = favorite;
			if (saveChanges)
			{
				(this.IsCloudSave ? Main.CloudFavoritesData : Main.LocalFavoriteData).SaveFavorite(this);
			}
		}

		// Token: 0x06001E5E RID: 7774
		public abstract void SetAsActive();

		// Token: 0x06001E5F RID: 7775
		public abstract void MoveToCloud();

		// Token: 0x06001E60 RID: 7776
		public abstract void MoveToLocal();

		// Token: 0x0400195C RID: 6492
		protected string _path;

		// Token: 0x0400195D RID: 6493
		protected bool _isCloudSave;

		// Token: 0x0400195E RID: 6494
		public FileMetadata Metadata;

		// Token: 0x0400195F RID: 6495
		public string Name;

		// Token: 0x04001960 RID: 6496
		public readonly string Type;

		// Token: 0x04001961 RID: 6497
		protected bool _isFavorite;
	}
}
